var formChild = null, _cheked = false, editor, aLetras = new Array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'i', 'j', 'k', 'l', 'n', 'm', 'o', 'p', 'q', 'e', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'), aNumeros = new Array('1', '2', '3', '4', '5', '6', '7', '8', '9');

function getIdRandom() {
    var cNumero = aNumeros[Math.floor(Math.random() * aNumeros.length)];
    var cLetra = aLetras[Math.floor(Math.random() * aLetras.length)] + aNumeros[Math.floor(Math.random() * aNumeros.length)] + aLetras[Math.floor(Math.random() * aLetras.length)] + aNumeros[Math.floor(Math.random() * aNumeros.length)] + aLetras[Math.floor(Math.random() * aLetras.length)] + aNumeros[Math.floor(Math.random() * aNumeros.length)] + aLetras[Math.floor(Math.random() * aLetras.length)] + aNumeros[Math.floor(Math.random() * aNumeros.length)] + aNumeros[Math.floor(Math.random() * aNumeros.length)] + aLetras[Math.floor(Math.random() * aLetras.length)] + aNumeros[Math.floor(Math.random() * aNumeros.length)] + aNumeros[Math.floor(Math.random() * aNumeros.length)] + aLetras[Math.floor(Math.random() * aLetras.length)] + aNumeros[Math.floor(Math.random() * aNumeros.length)] + aLetras[Math.floor(Math.random() * aLetras.length)] + aNumeros[Math.floor(Math.random() * aNumeros.length)];

    return cLetra;
}

function validateFormAct() {
    $("#frm-act").validate({
        event: "blur",
        rules: {
            'txttitre2': "required",
            'txtcontenido': "required"
        },
        messages: {
            'txttitre2': "Entrez votre Titre.",
            'txtcontenido': "Entrez votre Description."
        }
    });

    $('#txttitre2').select();
}

function _delete(obj) {
    var _bg = '#f0f9ff';
    $("#" + obj).animate({
        backgroundColor: "#fbec89"
    }, 'fast', function() {
        if (confirm("Voulez-vous vraiment supprimer?")) {
            $("#" + obj).fadeOut('slow', function() {
                $.deleteActualitesBox($("#" + obj).attr('lang'), $("#" + obj));
            });
        }
        else
            $("#" + obj).animate({
                backgroundColor: _bg
            }, {
                duration: "fast"
            });
    });
}

var _obj = "";
function _update(obj) {
    var _bg = '#f0f9ff';
    $("#" + obj).animate({
        backgroundColor: "#fbec89"
    }, 'fast', function() {

        _membre = $("#" + obj).attr('value');
        _mode = "update";

        $('#Nouveau-title2').html("Modifier l'actualit&eacute;");
        $.getOtherActualite(_membre);

        $("#Nouveau2").modal({
            position: [0, 0],
            opacity: 45,
            autoResize: true,
            onOpen: function(dialog) {
                dialog.overlay.fadeIn('fast', function() {
                    dialog.container.fadeIn('fast', function() {
                        dialog.data.show();
                        validateFormAct();
                    });
                });
            },
            onClose: function(dialog) {
                if (_obj != '')
                    $(_obj).animate({
                        backgroundColor: '#f0f9ff'
                    }, {
                        duration: "medium"
                    });
                $.modal.close();
            }
        });
    });
    _obj = "#" + obj;
}

function makeBox(_id, _section, _title, _column) {
    var _k = getIdRandom();
    var _bg = '#f0f9ff';
    $("#" + _column).prepend('<li class="portlet" lang="' + _id + '" style="display:none; background:' + _bg + '; " id="' + _k + '"><div class="portlet-header"><span class="ui-icon ui-icon-arrow-4"></span><strong>SECTION : ' + _section + '</strong><br /><em>' + _title + '</em><div class="t-controls"><a class="page_white_delete" href="javascript:_delete(' + "'" + _k + "'" + ');">Supprimer</a></div></div></li>');

    $("#" + _k).fadeIn(500);
}

function makeBox2(_id, _section, id_actualite, _title, _column) {
    var _k = getIdRandom();
    var _bg = '#f0f9ff';

    _edit = '<a class="page_white_edit" href="javascript:_update(' + "'" + _k + "'" + ');">Editer</a>';
    $("#" + _column).prepend('<li class="portlet" lang="' + _id + '" value="' + id_actualite + '" style="display:none; background:' + _bg + '; " id="' + _k + '"><div class="portlet-header"><span class="ui-icon ui-icon-arrow-4"></span><strong>' + _section + '</strong><br /><em class="sub_title">' + _title + '</em><div class="t-controls">' + _edit + '<a class="page_white_delete" href="javascript:_delete(' + "'" + _k + "'" + ');">Supprimer</a></div></div></li>');

    $("#" + _k).fadeIn(500);
}

function editorTXT() {
    new nicEditor({
        buttonList: [
            'bold', 'italic', 'underline', 'strikethrough', 'left', 'justify', 'link', 'unlink', 'removeformat'
        ],
        iconsPath: './Resouces/js/wysiwyg/nicEditorIcons.gif',
        maxHeight: 180
    }).panelInstance('txtcontenido', {
        hasPanel: true
    });

    editor = nicEditors.findEditor('txtcontenido');
}

$(function() {
    $.fn.reset = function() {
        $(this).each(function() {
            this.reset();
        });
    }
    var _mode = "";
    var _membre = "";

    /* JQUERY_EXTEND */
    $.extend({
        // PHOTOS
        initPhotos: function() {
            editorTXT();
            $(".column").sortable({
                connectWith: '.column',
                stop: function(event, ui) {
                    $.updateActualiteBox();
                }
            });
            $(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all").find(".portlet-header").prepend('<span class="ui-icon ui-icon-arrow-4"></span>').end().find(".portlet-content");
            $(".column").disableSelection();

            $("#sinsertact").click(function() {
                var _s = $("#jqGrid").getGridParam('selrow');
                if (_s != null) {
                    $('#jqGrid2').trigger('reloadGrid');
                    $("#JLModal-content").JLModal({
                        opacity: 60,
                        duration: 150,
                        titleHTML: "Liste des actualit&eacute;s"
                    });
                }
                else
                    alert('Avertissement\nS\u00E9lectionnez la newsletter.');
            });

            $("#sinsertact-csme").click(function() {
                var _s = $("#jqGrid").getGridParam('selrow');
                if (_s != null) {
                    $('#jqGrid3').trigger('reloadGrid');
                    $("#JLModal-act").JLModal({
                        opacity: 60,
                        duration: 150,
                        titleHTML: "Liste des infos diverses"
                    });
                }
                else
                    alert('Avertissement\nS\u00E9lectionnez la newsletter.');
            });
            $("#idhide").click(function() {
                $("#JLModal-content").JLModal.close();
            });
            $("#idhide2").click(function() {
                $("#sinsertact-csme").JLModal.close();
            });

            $("#jqGrid2").jqGrid({
                // <MODIFICAR>
                url: './Queries/query-actualites.php?nd=' + new Date().getTime(),
                colNames: ['int_actualite', 'Actualit&eacute;', 'Publi&eacute;', 'Titre', 'Sections', 'Vote', 'Etat'],
                colModel: [
                    {
                        hidden: true,
                        search: false,
                        name: 'int_actualite',
                        index: 'int_actualite',
                        align: 'left'
                    },
                    {
                        hidden: true,
                        name: 'var_monthyear',
                        index: 'var_monthyear',
                        align: 'left'
                    },
                    {
                        name: 'dat_creation_act',
                        index: 'dat_creation_act',
                        align: 'left'
                    },
                    {
                        name: 'var_ac_title',
                        index: 'var_ac_title',
                        align: 'left'
                    },
                    {
                        name: 'var_desc_section',
                        index: 'var_desc_section',
                        align: 'left'
                    },
                    {
                        name: 'int_vote',
                        index: 'int_vote',
                        align: 'center'
                    },
                    {
                        name: 'var_htmldesc',
                        index: 'var_htmldesc',
                        align: 'left'
                    }
                ],
                sortname: ['int_actualite'],
                sortorder: "desc",
                width: 700,
                height: 300,
                // </MODIFICAR>

                loadtext: 'Chargement...',
                datatype: "json",
                pager: $('#jqpager2'),
                rowNum: 100,
                rowList: [100, 200, 300],
                viewrecords: true,
                multiselect: false
            });

            $("#jqGrid").jqGrid({
                // <MODIFICAR>
                url: './Queries/query-newsletter.php?nd=' + new Date().getTime(),
                colNames: ['int_id_newsletter', 'Titre de la newsletter', 'Etat', 'Statut d\'envoi'],
                colModel: [{
                        hidden: true,
                        search: false,
                        name: 'int_id_newsletter',
                        index: 'int_id_newsletter',
                        align: 'left'
                    }, {
                        name: 'var_nom_newsletter',
                        index: 'var_nom_newsletter',
                        align: 'left'
                    }, {
                        search: false,
                        name: 'var_htmldesc',
                        index: 'var_htmldesc',
                        align: 'left'
                    }, {
                        search: false,
                        name: 'int_sent',
                        index: 'int_sent',
                        formatter: $.formatImage,
                        align: 'left'
                    }
                ],
                sortname: ['int_id_newsletter'],
                sortorder: "desc",
                width: 746,
                height: 240,
                // </MODIFICAR>

                onSelectRow: function(ids) {
                    var gr = $("#jqGrid").getGridParam('selrow');
                    if (gr != null) {
                        $.getPhoto(ids);
                    }
                },
                loadComplete: function(xhr) {
                    if (_mode == "insert" || _mode == "charger" || _mode == "update") {
                        $('#jqGrid').setSelection(_membre);
                    }
                    _mode = "";
                },
                loadtext: 'Chargement..',
                datatype: "json",
                pager: $('#jqpager'),
                rowNum: 50,
                rowList: [50, 75, 100],
                viewrecords: true,
                multiselect: false
            });

            $("#jqGrid3").jqGrid({
                // <MODIFICAR>
                url: './Queries/query-other-actualite.php?nd=' + new Date().getTime(),
                colNames: ['int_actualite', 'Titre', 'Vote'],
                colModel: [{
                        hidden: true,
                        search: false,
                        name: 'int_id_other_actualites',
                        index: 'int_id_other_actualites',
                        align: 'left'
                    }, {
                        name: 'var_ac_title',
                        index: 'var_ac_title',
                        align: 'left'
                    }, {
                        name: 'int_vote',
                        index: 'int_vote',
                        align: 'center'
                    }
                ],
                sortname: 'int_actualite',
                sortorder: "asc",
                width: 700,
                height: 300,
                // </MODIFICAR>

                loadtext: 'Chargement...',
                datatype: "json",
                pager: $('#jqpager3'),
                rowNum: 50,
                rowList: [50, 100, 150],
                viewrecords: true,
                multiselect: false
            });
        },
        formatImage: function(cellvalue, options, rowObject) {
            return (cellvalue != '0') ? '<b style="color:black;">En cours d\'envoi...</b>' :
                '<b style="color:#999; font-weight: normal;">En attente</b>';
        },
        updateActualiteBox: function() {
            var _c1 = "";
            var _c2 = "";
            var i = 1;
            var k = 0;
            var _val1 = "";
            var _val2 = "";
            var _t = $("#col01 li").length;
            $("#col01 li").each(function() {
                if (_t == i)
                    k = "";
                else
                    k = ",";
                _val1 += $(this).attr('lang') + "-" + i + k;
                i++;
            });
            i = 1;
            var _t = $("#col02 li").length;
            $("#col02 li").each(function() {
                if (_t == i)
                    k = "";
                else
                    k = ",";
                _val2 += $(this).attr('lang') + "-" + i + k;
                i++;
            });

            $.post("./?ws=Newsletter&act=updateActualiteBox", {
                _col1: _val1,
                _col2: _val2,
                cache: new Date().getTime()
            }, function(data) {
                if ($.trim(data) != "") {
                    // alert("Donn\u00E9es sauvegarder avec succ\u00E8s.");
                }
            });
        },
        insertPhotos: function(_var_nom_newsletter, _int_id_state) {
            $.post("./?ws=Newsletter&act=insertNewsletter", {
                _var_nom_newsletter: _var_nom_newsletter,
                _int_id_state: _int_id_state,
                cache: new Date().getTime()
            }, function(data) {
                if ($.trim(data) != "") {
                    _membre = $.trim(data);
                    _mode = "charger";
                    alert("Donn\u00E9es sauvegarder avec succ\u00E8s.");
                    $('#jqGrid').trigger('reloadGrid');
                    $.modal.close();
                }
            });
        },
        updatePhotos: function(_id, _var_nom_newsletter, _int_id_state) {
            $.post("./?ws=Newsletter&act=updateNewsletter", {
                _id: _id,
                _var_nom_newsletter: _var_nom_newsletter,
                _int_id_state: _int_id_state,
                cache: new Date().getTime()
            }, function(data) {
                if ($.trim(data) != "") {
                    _mode = "charger";
                    $('#jqGrid').trigger('reloadGrid');
                    alert($.trim(data));
                    $.modal.close();
                }
                else
                    $.modal.close();
            });
        },
        getPhoto: function(_id) {
            $.post("./?ws=Newsletter&act=getNewsletter", {
                _id: _id,
                cache: new Date().getTime()
            }, function(data) {
                if ($.trim(data) != "") {
                    var _data = Array();
                    _data = data.split('_%_');
                    $("#tl-views-photos").text(" : " + $.trim(_data[0]));
                    $('#txtdescription').val($.trim(_data[0]));
                    selectCbo('#cboetat', $.trim(_data[1]));

                    //Get Actualites Box
                    $.getActualitesBox(_id);
                }
            });
        },
        deletePhotos: function(_ids) {
            $.post("./?ws=Newsletter&act=deleteNewsletter", {
                _ids: _ids,
                cache: new Date().getTime()
            }, function(data) {
                if ($.trim(data) != "") {
                    $("#col01").html('');
                    $("#col02").html('');
                    alert(data);
                    $('#jqGrid').trigger('reloadGrid');

                }
            });
        },
        // END PHOTOS
        deleteActualitesBox: function(_id, _obj) {
            $.post("./?ws=Newsletter&act=deleteActualiteBox", {
                _id: _id,
                cache: new Date().getTime()
            }, function(data) {
                if ($.trim(data) != "") {
                    _obj.remove();
                    alert(data);
                    $.updateActualiteBox();
                }
            });
        },
        getActualitesBox: function(_id) {
            $.getJSON("./?ws=Newsletter&act=getActualitesBox", {
                _id: _id,
                cache: new Date().getTime()
            },
            function(data) {
                $("#col01").html('');
                $("#col02").html('');

                if (data != null) {
                    if (data.item1 != null) {
                        $.each(data.item1, function(i, item) {
                            if (item.int_id_section == 27) {
                                makeBox2(item.id_actualite_box, "Info diverse", item.int_id_actualite, $.trim(item.var_ac_title), $.trim(item.var_column));
                            }
                            else
                                makeBox(item.id_actualite_box, item.var_desc_section, item.var_ac_title, item.var_column);

                        });

                        $.updateActualiteBox();
                    }
                }
            });
        },
        setActualiteBox: function(_var_column, _int_id_actualite, _int_no_csme_actualite, _int_id_newsletter) {
            $.post("./?ws=Newsletter&act=getActualiteById", {
                _var_column: _var_column,
                _int_id_actualite: _int_id_actualite,
                _int_no_csme_actualite: _int_no_csme_actualite,
                _int_id_newsletter: _int_id_newsletter,
                cache: new Date().getTime()
            },
            function(data) {
                if ($.trim(data) != "") {
                    $('#jqGrid').setSelection(_int_id_newsletter);
                    $("#JLModal-content").JLModal.close();
                }
            });
        },
        insertOtherActualite: function(_var_title, _txt_description) {
            $.post("./?ws=Newsletter&act=insertOtherActualite", {
                _var_title: _var_title,
                _txt_description: _txt_description,
                cache: new Date().getTime()
            },
            function(data) {
                if ($.trim(data) != "") {
                    $("#frm-act").reset();
                    alert("Donn\u00E9es sauvegarder avec succ\u00E8s.");
                    $('#jqGrid3').trigger('reloadGrid');
                }
                $.modal.close();
            });
        },
        updateOtherActualite: function(_id, _var_title, _txt_description) {
            $.post("./?ws=Newsletter&act=updateOtherActualite", {
                _id: _id,
                _var_title: _var_title,
                _txt_description: _txt_description,
                cache: new Date().getTime()
            },
            function(data) {
                if ($.trim(data) != "") {
                    $("#frm-act").reset();
                    alert("Donn\u00E9es sauvegarder avec succ\u00E8s.");
                    $('#jqGrid3').trigger('reloadGrid');
                }
                $.modal.close();
                if (_obj != '') {
                    $(_obj).find('em').html(_var_title);
                    $(_obj).animate({
                        backgroundColor: '#f0f9ff'
                    }, {
                        duration: "medium"
                    });
                }
            });
        },
        getOtherActualite: function(_id) {
            $.getJSON("./?ws=Newsletter&act=getOtherActualite", {
                _id: _id,
                cache: new Date().getTime()
            },
            function(data) {
                if (data != null) {
                    $('#txttitre2').val(data.var_ac_title);
                    editor.setContent(data.txt_content_actualite);
                    _membre = _id;
                    _mode = "update";
                }
            });
        },
        deleteOtherActualite: function(_id) {
            $.post("./?ws=Newsletter&act=deleteOtherActualite", {
                _id: _id,
                cache: new Date().getTime()
            }, function(data) {
                if ($.trim(data) != "") {
                    alert(data);
                    $('#jqGrid3').trigger('reloadGrid');
                }
            });
        },
        program: function(_id) {
             $.post("./?ws=Newsletter&act=programSending", {
                _id: _id,
                cache: new Date().getTime()
            }, function(data) {
                if ($.trim(data) != "") {
                    $('#jqGrid').trigger('reloadGrid');
                    alert('L\'envoi de la newsletter est programmé. Un e-mail vous sera transmit une fois l\'envoi achevé.');
                }
            });
        }
    });
    /* END JQUERY_EXTEND */

    function validateForm() {
        $('#txtdescription').select();
        $("#frm-lien").validate({
            event: "blur",
            rules: {
                'txtdescription': "required",
                'cboetat': "required"
            },
            messages: {
                'txtdescription': "Entrez le titre de la newsletter.",
                'cboetat': "S&eacute;lectionnez l'&eacute;tat."
            }
        });

        function disabledControls(val) {
            if (val) {
                $('#txtdescription').attr('disabled', '-1');
                $('#cboetat').attr('disabled', '-1');
            }
            else {
                $('#txtdescription').removeAttr('disabled');
                $('#cboetat').removeAttr('disabled');

                $("#btn-save").removeAttr('disabled');
            }
        }

        // SAVE FORM
        $("#frm-lien").submit(function() {
            if ($("#frm-lien").valid()) {
                disabledControls(true);
                if (_mode == "update") {
                    $.updatePhotos(_membre, $('#txtdescription').val(), $('#cboetat').val());
                    _mode = "";
                }
                else if (_mode == "insert") {
                    $.insertPhotos($('#txtdescription').val(), $('#cboetat').val());
                    _mode = "";
                }
                disabledControls(false);
            }

            return false;
        });
    }
    ;

    function selectCbo(_idcbo, _intval) {
        $(_idcbo + " option").each(function() {
            if ($(this).val() == _intval) {
                $(this).attr('selected', 'selected');
            }
        });
    }
    $("#btn-cancel").click(function() {
        $.modal.close();
    });
    $("#btn-terminer").click(function() {
        $.modal.close();
    });
    $("#btn-annuler").click(function() {
        $.modal.close();
    });
    // Agregar Actualie
    $("#idSave").click(function() {
        var _s = $("#jqGrid2").getGridParam('selrow');
        if (_s != null) {
            $.setActualiteBox("col01", $("#jqGrid2").getGridParam('selrow'), 0, $("#jqGrid").getGridParam('selrow'));
        } else
            alert('Avertissement!\nS\u00E9lectionnez une actualit\u00E9 parmi la liste.');
    });
    $("#siinsert").click(function() {
        _mode = "insert";
        $('#Nouveau-title2').html("Ajouter une Actualit&eacute;");
        $("#Nouveau2").modal({
            position: [0, 0],
            opacity: 25,
            autoResize: true,
            onOpen: function(dialog) {
                dialog.overlay.fadeIn('fast', function() {
                    dialog.container.fadeIn('fast', function() {
                        dialog.data.show();
                        validateFormAct();
                    });
                });
            }
        });
    });
    $("#siupdate").click(function() {
        _mode = "update";
        var gr = $("#jqGrid3").getGridParam('selrow');
        $('#Nouveau-title2').html("Modifier l'actualit&eacute;");

        switch (gr)
        {
            case null:
                alert('Avertissement\nS\u00E9lectionnez l\'actualit\u00E9.');
                break;

            default:
                _membre = gr;
                $.getOtherActualite(_membre);
                $("#Nouveau2").modal({
                    position: [0, 0],
                    opacity: 45,
                    autoResize: true,
                    onOpen: function(dialog) {
                        dialog.overlay.fadeIn('fast', function() {
                            dialog.container.fadeIn('fast', function() {
                                dialog.data.show();
                                validateFormAct();
                            });
                        });
                    }
                });
                break;
        }
    });
    $("#sidelete").click(function() {
        _mode = 'delete';
        var gr = $("#jqGrid3").getGridParam('selrow');

        if (gr != null) {
            if (confirm("Eliminer actualit\u00E9\nVous avez selection\u00E9 actualit\u00E9.\nVoulez vous vraiment l'effacer?")) {
                $.deleteOtherActualite(gr);
            }
        }
        else {
            alert('Avertissement\nS\u00E9lectionnez l\'actualit\u00E9 \u00E0 effacer.');
        }
    });

    $("#btn-cancel2").click(function() {
        $.modal.close();
    });
    $("#frm-act").submit(function() {
        //TERMINAR
        if ($("#frm-act").valid()) {
            disabledAllControls("#frm-act", true);
            if (_mode == "update") {
                disabledAllControls("#frm-act", false);
                $.updateOtherActualite(_membre, $('#txttitre2').val(), editor.getContent());
            }
            else {
                disabledAllControls("#frm-act", false);
                $.insertOtherActualite($('#txttitre2').val(), editor.getContent());
            }
        }

        return false;
    });

    $("#idSave2").click(function() {
        var _s = $("#jqGrid3").getGridParam('selrow');
        if (_s != null) {
            $.setActualiteBox("col01", $("#jqGrid3").getGridParam('selrow'), 1, $("#jqGrid").getGridParam('selrow'));
        } else
            alert('Avertissement!\nS\u00E9lectionnez un actualit\u00E9 parmi la liste.');
    });

    $("#sinsert").click(function() {
        _mode = "insert";
        $('#Nouveau-title').html("Ajouter une newsletter");
        selectCbo('#cboetat', "");
        $('#txtdescription').val('');

        $("#Nouveau").modal({
            position: [0, 0],
            opacity: 25,
            autoResize: true,
            onOpen: function(dialog) {
                dialog.overlay.fadeIn('fast', function() {
                    dialog.container.fadeIn('fast', function() {
                        dialog.data.show();
                        validateForm();
                    });
                });
            }
        });
    });

    $("#supdate").click(function() {
        var gr = $("#jqGrid").getGridParam('selrow');
        _mode = "update";

        $('#Nouveau-title').html("Modifier la newsletter");
        switch (gr)
        {
            case null:
                alert('Avertissement!\nS\u00E9lectionnez une newsletter parmi la liste.');
                break;

            default:
                _membre = gr;
                $.getPhoto(_membre);
                $("#Nouveau").modal({
                    position: [0, 0],
                    opacity: 45,
                    autoResize: true,
                    onOpen: function(dialog) {
                        dialog.overlay.fadeIn('fast', function() {
                            dialog.container.fadeIn('fast', function() {
                                dialog.data.show();
                                validateForm();
                            });
                        });
                    }
                });
                break;
        }
    });

    $("#sdelete").click(function() {
        _mode = 'delete';
        var gr = $("#jqGrid").getGridParam('selrow');

        if (gr != null) {
            if (confirm("Eliminer newsletter\nVous avez selection\u00E9 newsletter.\nVoulez vous vraiment l'effacer(s)?")) {
                $.deletePhotos(gr);
            }
        }
        else {
            alert('Avertissement\nS\u00E9lectionnez les newsletters \u00E0 effacer.');
        }
    });


    $("#sprog").click(function() {
        _mode = 'prog';
        var gr = $("#jqGrid").getGridParam('selrow');
        var rowData = $('#jqGrid').jqGrid('getRowData', gr);
        
        if (gr != null) {
            if (confirm("Vous desirez programmer l'envoi de la newsletter suivante : " + rowData.var_nom_newsletter)) {
                $.program(gr);
            }
        } else {
            alert('Avertissement\nS\u00E9lectionnez la newsletter \u00E0 envoyer.');
        }
    });



    //Initializing
    $.initPhotos();

    function disabledAllControls(_idForm, _bool) {
        $(_idForm + " input,textarea,select").each(function(i) {
            if (_bool)
                $(this).attr('disabled', '-1');
            else
                $(this).removeAttr('disabled');
        });
    }

});